import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { GlobalService } from '../../global.service';
import { PersonInfo } from '../person-info';
import { MenusService } from '../../components/sidenav/menus.services.component';

@Component({
  selector: 'app-info-add-form',
  templateUrl: './info-add-form.component.html',
  styleUrls: ['./info-add-form.component.less']
})
export class InfoAddFormComponent implements OnInit {

  submitted = false;

  private personInfo = new PersonInfo('', '', '', '', '');
  constructor( private router: Router, private globalService: GlobalService, private menuService: MenusService) { }

  onSubmit() {
    this.submitted = true;
    localStorage.setItem('info', JSON.stringify(this.personInfo));
    alert('添加成功');
    this.globalService.isLogin = true;
    // this.menuService.getMenu();
    this.router.navigate(['main/index-page']);
  }

  ngOnInit() {
  }

}
